// 根据访问量和阈值计算当前应该使用的分组索引（仅考虑启用的分组）
exports.getCurrentGroupOffset = (visitCount, threshold, enabledGroups) => {
    if (!enabledGroups || enabledGroups.length === 0) {
        return 0;
    }
    return Math.floor(visitCount / threshold) % enabledGroups.length;
};

// 根据分组索引获取对应的分组ID
exports.getCurrentGroupId = (visitCount, threshold, enabledGroups) => {
    const groupIndex = exports.getCurrentGroupOffset(visitCount, threshold, enabledGroups);
    return enabledGroups[groupIndex].id;
};